package cn.gson.boot.controller;

import cn.gson.boot.model.pojos.Hebing;
import cn.gson.boot.model.service.HebingService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/hebing")
public class HebingController {
    @Autowired
    HebingService hebingService;

    //分页查询合并客户表
    @RequestMapping("/hebing-list")
    @ResponseBody
    public Map<String,Object> allHebings(Integer pageNum,Integer pageSize){
        Page<Object> obj = PageHelper.startPage(pageNum, pageSize);

        List<Hebing> hebingList = hebingService.allHebings();
        Map<String,Object> map = new HashMap<>();
        map.put("total",obj.getTotal());
        map.put("rows",hebingList);
        return map;
    }
}
